﻿using System;
using Irony.Parsing;

namespace Gumini.JulaDB
{
    public class SourcePosition
    {
        /// <summary>
        /// Creates a new instance of SourcePosition.
        /// Adds 1 to line and column numbers as we number them starting at 1.
        /// </summary>
        /// <param name="location"></param>
        public SourcePosition(SourceLocation location)
            : this(location.Line + 1, location.Column + 1) { }

        public SourcePosition(int lineNumber, int columnNumber)
        {
            this.LineNumber = lineNumber;
            this.ColumnNumber = columnNumber;
        }

        public int LineNumber { get; private set; }

        public int ColumnNumber { get; private set; }

        public override string ToString()
        {
            return String.Format("line: {0}, column: {1}", LineNumber, ColumnNumber);
        }
    }
}
